<?
	ini_set( "display_errors", "E_NOTICE" );
	ini_set( "log_errors", 0 );
	include_once "generateur.class.php";
	include "connexion.php";
	
	
	$class = "";
	if( isset( $_POST[ 'txtNomClass' ] ) &&
		isset( $_POST[ 'txtNomTable' ] ) &&
		isset( $_POST[ 'txtHost' ] ) &&
		isset( $_POST[ 'txtNomBd' ] ) &&
		isset( $_POST[ 'txtUser' ] ) &&
		isset( $_POST[ 'txtPass' ] ) &&
		isset( $_POST[ 'btnGo' ] ) ) {
		
		$gen = new Generateur( $_POST[ 'txtNomClass' ], $_POST[ 'txtNomTable' ] );
		$gen->setBD( $_POST[ 'txtHost' ], $_POST[ 'txtNomBd' ], $_POST[ 'txtUser' ], $_POST[ 'txtPass' ] );
		$class = $gen->creer();


	}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Générateur de classes PHP 4</title>
</head>

<body>
<h2 style="text-align:center;">Générateur de classes PHP 4</h2>
<br /><br />
<form name="frm_class" id="frm_class" action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
	Nom de la classe : <br />
	<input type="text" name="txtNomClass" id="txtNomClass" > <br />	Nom de la table ciblée <br />
	<input type="text" name="txtNomTable" id="txtNomTable" > <br />
	Host : <br />
	<input type="text" name="txtHost" id="txtHost" value="10.221.10.113" > <br />
	Nom de la base de données : <br />
	<input type="text" name="txtNomBd" id="txtNomBd" value="leshebdos" > <br />
	nom d'usager : <br />
	<input type="text" name="txtUser" id="txtUser" > <br />
	Mot de passe : <br />
	<input type="password" name="txtPass" id="txtPass"> <br />
	<input type="submit" name="btnGo" id="btnGo" value="Généré !" > <br /><br /><br />
</form>
	<a href="javascript:document.boxCode.code.select();">Sélectionner le code</a>
<form name="boxCode" id="boxCode" >
	<textarea name="code" cols="115" rows="50" id="code"><? echo $class; ?></textarea>
</form>
</body>
</html>
